package com.qf.lanzhou.blog.api.controller;

import com.qf.lanzhou.blog.api.controller.notification.NotificationShowServlet;
import com.qf.lanzhou.blog.api.pojo.entity.Page;
import com.qf.lanzhou.blog.api.service.NotificationService;
import com.qf.lanzhou.blog.api.service.impl.NotificationServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

/**
 * @author jack
 * 傻逼东辉的尾页功能
 */
@WebServlet("/lastNotification.do")
public class LastNotificationServlet extends BaseServletPost {
    private Page page = new Page(1);
    private NotificationService notificationService=new NotificationServiceImpl();
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        //获取总行数，总页码数
        Integer count = notificationService.getCount();
        page.setTotalCounts(count);
        NotificationShowServlet.numberPage = page.getTotalPage();
        List list = notificationService.selectPage(NotificationShowServlet.numberPage);
        successResultWrite(list,resp);
    }
}
